package net.aimeizi.quartz.utils;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

public class JsonResult {

    public Integer resultCode = 1000;

    public String resultMsg = "";

    public Object resultData = null;

    public static JsonResult build() {
        return new JsonResult();
    }

    public JsonResult fail(String msg) {
        this.fail(0, msg);
        return this;
    }

    public JsonResult fail(Integer resultCode) {
        this.fail(resultCode, "");
        return this;
    }

    public JsonResult fail(Integer resultCode, String msg) {
        this.resultCode = resultCode;
        this.resultMsg = msg;
        return this;
    }

    public JsonResult success() {
        this.success("", null);
        return this;
    }

    public JsonResult success(Object data) {
        this.success("操作成功", data);
        return this;
    }

    public JsonResult success(String resultMsg, Object resultData) {
        this.resultCode = 1000;
        this.resultMsg = resultMsg;
        this.resultData = resultData;
        return this;
    }

}
